package com.my.redis.dao.impl;

import com.my.redis.IRedisManager;
import com.my.redis.RedisSupport;
import com.my.redis.dao.ITokenManager;
import com.my.security.TokenInfo;
import com.my.utils.CommonUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundKeyOperations;
import org.springframework.data.redis.core.BoundSetOperations;
import org.springframework.data.redis.core.BoundValueOperations;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.data.redis.serializer.GenericToStringSerializer;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * IManager
 * Created by 80002023 on 2016/6/13.
 */
@Component
public class TokenManagerImpl extends RedisSupport<String, TokenInfo> implements ITokenManager {

    private final Logger logger = LogManager.getLogger(getClass());

    @Autowired
    private IRedisManager redisManager;

    public boolean save(TokenInfo record) {
        BoundValueOperations<String, TokenInfo> ops = this.redisTemplate.boundValueOps(record.getToken());
        logger.info("token save redis ... {}",ops.getType());
        //ops.set(record);
        //ops.add(record,record);

        return false;
    }

    public boolean save(List<TokenInfo> records) {
        return false;
    }

    public boolean update(TokenInfo record) {
        return false;
    }

    public TokenInfo get(String key) {
        TokenInfo a = redisTemplate.opsForValue().get(key);
        return null;
    }

    public List<TokenInfo> get(List<String> keys) {
        return null;
    }
}
